<%@ include file="/taglibs.jsp"%>
<jsp:directive.page import="java.util.Random"/>
<jsp:directive.page import="java.util.Date"/>
<%if(session.getAttribute("randFormID") == null){
	Random gen = new Random(new Date().getTime());
	session.setAttribute("randFormID", gen.nextInt() + "");
}
%>


<title>Winter War Gaming Convention - Online Event Submission Form</title>
<h1>Winter War Convention Event Submission Form</h1>

<p>The Winter War Gaming Convention is seeking judges to organize and run games at its 37th annual Winter War Gaming Convention, January 29 - 31, 2010, held at the Hawthorn Suites in Champaign, IL. Judges who run a single event receive a 50% discount on weekend registration or free registration for a single day. Judges who run two or more events receive free weekend registration. Judges must pay for events they play in.</p>

<p>In order for proposed events to appear in the convention pre-registration packet, forms must be received no later than <b>December 1, 2009</b>; the final deadline for events to be listed in the convention program is <b>January 10, 2010</b>.</p>

<%if(session.getAttribute("userID") == null) { %>
<hr/>
<p> We're sorry, but this feature is only available to users who are logged in.  Please either log in below, or create a new account! We'd love to have you!
</p>
<html:form action="/user" focus="user.username">
	<input type="hidden" name="method" value="login"/>
	<table>
		<tr>
			<th><bean:message key="user.username"/>: </th>
			<td><html:text property="user.username"/></td>
			<th><bean:message key="user.password"/>: </th>
			<td><html:password property="user.password"/></td>
		</tr>
		<tr>
			<td><html:submit styleClass="button">Login</html:submit></td>
			<td><input type="button" value="New Account" onclick="document.location.href='./user.do?method=edit'"/></td>
		</tr>
	</table>
</html:form>
<%} else { %>
<html:form action="/event" onsubmit="return validateEventForm(this)">
	<input type="hidden" name="method" value="save"/>
	<input type="hidden" name="formID" value="<%=session.getAttribute("randFormID") %>"/>
	<input type="hidden" name="fromUser" value="1"/>
	<input type="hidden" name="event.conID" value="${conID }"/>
	<html:hidden property="event.eventID"/>
	<input type="hidden" name="event.userID" value="<%=session.getAttribute("userID") %>"/>
	<html:hidden property="event.status" value="1"/>
	<html:hidden property="event.eventCode" value="-"/>
	<table>
		<tr>
			<th><bean:message key="event.eventName"/>: </th>
			<td><html:text property="event.eventName"/></td>
			<th><bean:message key="event.rules"/>: </th>
			<td><html:text property="event.rules"/></td>
		</tr>
		<tr>
			<th><bean:message key="event.eventDesc"/>: </th>
			<td colspan="3"><html:textarea property="event.eventDesc" onkeyup="doCount(this)"/><span id="count">(0/600 used)</span></td>
		</tr>
		<tr>
			<th><bean:message key="event.totalSeats"/>: </th>
			<td><html:text property="event.totalSeats"/></td>
			<th><bean:message key="event.slots"/>: </th>
			<td><html:text property="event.slots"/></td>
		</tr>
		<tr>
			<th><bean:message key="event.slot"/>: </th>
			<td colspan="3"><html:select property="event.slotID">
				<c:forEach var="slot" items="${slots}" varStatus="status">
					<c:choose>
						<c:when test="${!slot.isLocked }">
							<html:option value="${slot.slotID}">${slot.slotName}, ${slot.startDateDate}, ${slot.startDateHour} ${slot.startDateAMPM }</html:option>
						</c:when>
					</c:choose>
				</c:forEach>
				</html:select>
			</td>
		</tr><tr>
			<th><bean:message key="event.altSlot"/>: </th>
			<td colspan="3"><html:select property="event.altSlotID">
				<html:option value=""></html:option>
				<c:forEach var="slot" items="${slots}" varStatus="status">
					<c:choose>
						<c:when test="${!slot.isLocked }">
							<html:option value="${slot.slotID}">${slot.slotName}, ${slot.startDateDate}, ${slot.startDateHour} ${slot.startDateAMPM }</html:option>
						</c:when>
					</c:choose>
				</c:forEach>
				</html:select>
			</td>
		</tr>
		<tr>
			<th><bean:message key="event.playerExperience"/>: </th>
			<td><html:select property="event.playerExperience">
					<html:option value="1"><bean:message key="event.experience1"/></html:option>
					<html:option value="2"><bean:message key="event.experience2"/></html:option>
					<html:option value="3"><bean:message key="event.experience3"/></html:option>
					<html:option value="4"><bean:message key="event.experience4"/></html:option>
					<html:option value="5"><bean:message key="event.experience5"/></html:option>
					<html:option value="6"><bean:message key="event.experience6"/></html:option>
				</html:select>
			</td>
			<th><bean:message key="event.tablesRequired"/>: </th>
			<td><html:text property="event.tablesRequired"/></td>
		</tr>
		<tr>
			<th><bean:message key="event.eventType"/></th>
			<td>
				<html:select property="event.eventType">
					<html:option value="1">Board Game</html:option>
					<html:option value="2">Card Game</html:option>
					<html:option value="3">Miniatures Event</html:option>
					<html:option value="4">Role Playing Event</html:option>
				</html:select>
			</td>
		</tr>
		<tr>
			<td></td>
			<td></td>
			<td></td>
			<td><html:submit>Save</html:submit></td>
		</tr>
	</table>
</html:form>
<script type="text/javascript" language="javascript">
	function doCount(field){
		if(field.value.length > 600){
			field.value = field.value.substring(0, 600);
		}
		var countArea = document.getElementById("count");
		countArea.innerHTML = "("+field.value.length+"/600 used)";
	}
</script>
<html:javascript formName="eventForm"/>

<%}%>
